When importing configuration from one site to another, the shortcut set UUID causes the import to fail.
Some steps to reproduce:
1) Export all config
2) Create a new site with drush site-install
3) Find the site UUID of the original site, and set the site UUID of the new site to be the same with drush config-set "system.site" uuid
4) drush config-import
[error] Drupal\Core\Config\ConfigImporterException: There were errors validating the config synchronization.
Entities exist of type <em class="placeholder">Shortcut link</em> and <em class="placeholder">Shortcut set</em> <em class="placeholder">Default</em>. These entities need to be deleted before importing. in Drupal\Core\Config\ConfigImporter->validate() (line 748 of /var/www/web/core/lib/Drupal/Core/Config/ConfigImporter.php).
In ConfigImportCommands.php line 357:
The import failed due to the following reasons:
Entities exist of type <em class="placeholder">Shortcut link</em> and <em class="placeholder">Shortcut set</em> <em class="placeholder">Default</em>. These entities need to be deleted before importing.Workarounds:
- Copy the contents of
shortcut.set.default.ymlfrom the target site into the config being imported - Run
drush ev '\Drupal::entityManager()->getStorage("shortcut_set")->load("default")->delete();'
| Comment | File | Size | Author |
|---|---|---|---|
| #80 | shortcut-3.png | 59.17 KB | extexan |
| #80 | shortcut-2.png | 168.4 KB | extexan |
| #80 | shortcut-1.png | 118.95 KB | extexan |
Comments
Comment #2
mtiftI am not able to reproduce this issue.
@danylevskyi, what did you mean by "export configuration using a single file"? Did you import and export a "Full archive"?
Comment #3
roynilanjan commentedSame problem as abobe I have got once try to run
/usr/local/drush8/drush config-import staging -yComment #4
roynilanjan commentedComment #5
roynilanjan commentedSame here http://dcycleproject.org/comment/2647#comment-2647
Comment #6
tstoecklerSo it seems that the UUID of the default shortcut set does not match in your exported configuration and in your active configuration.
I was able to reproduce this with the following steps:
drush cex -yshortcut.set.default.ymlfile of the exported configurationdrush cim -yThe question is how you got to the point of having different UUIDs in your configuration? Can someone post detailed steps starting from 0 how to reproduce this issue (without manually editing a config file, like above)?
Comment #7
roynilanjan commented@tstoeckler: YES your steps are fine to work-on but question is why *UUID* needs to change only for *short-cut* & *system.site* component, not for others?
Comment #8
roynilanjan commentedComment #9
roynilanjan commentedIs it possible to import
block_contentto import? This is found that after full import the block content unable to import in the db, the import block is missing/showing broken in the original region see http://drupal.stackexchange.com/questions/146037/block-error-on-cmiComment #10
roynilanjan commentedComment #11
mtift"Needs review" status is for a patch has been created and needs review and testing: https://www.drupal.org/issue-queue/status. There is no patch here.
Comment #12
jonathanshawI'm hitting this trying to import config into travis.
Some steps to reproduce:
1) Export all config
2) Create a new site with drush site-install
3) Find the site UUID of the original site, and set the site UUID of the new site to be the same with drush config-set "system.site" uuid
4) drush config-import
Problem is discussed here https://www.drupal.org/node/2638392. The solution suggested there:
drush ev '\Drupal::entityManager()->getStorage("shortcut_set")->load("default")->delete();'
works for me
Comment #13
ressaI was experimenting with the Dcycle workflow combined with drush make.
I can confirm that this is still a problem in Drupal 8.1.3, and that drush command mentioned in #12 breaks my site, unless I un-install and re-install the Shortcut module.
So run these three commands to make config-import possible:
EDIT: Still a problem in Drupal 8.3.5 (August 2017), and only one command is actually needed:
drush ev '\Drupal::entityManager()->getStorage("shortcut_set")->load("default")->delete();'Comment #14
roynilanjan commentedGood idea if we can sync the configuration of e.g. short-cut & system-site programmatic way in
hook_updateusing
then run the
drush cimComment #15
ressaUpdating Priority to Major, since this breaks the config-export > config-import workflow.
Comment #16
jonathanshawAccording to https://github.com/drush-ops/drush/pull/1875 and linked discussions, this can be fixed in many cases by either:
- specifying the minimal install profile (shortcuts come from standard); or
- using https://www.drupal.org/project/config_installer
Comment #17
youfei.sun commentedI'm getting a similar error at same location:
Drupal\Core\Config\ConfigImporter->validate() (line 730 of
....../docroot/core/lib/Drupal/Core/Config/ConfigImporter.php).
The import failed due for the following reasons:
Unable to install the standard module since
it does not exist.
Looks like it is still some install profile related issue.
Comment #18
-enzo- commentedYou could fix using Drupal Console, using 1.0.0-RC1 or superior
Comment #19
marcelovaniI cannot run the drush command because the error happens during drush site-install when I specify the folder to sync
drush si -y standard --config-dir=../config/syncComment #20
staalex commentedComment #21
staalex commentedThe standard installation profile automatically creates two shortcuts in standard.install
A workaround would be to create a custom installation profile where you don't create these two entities on install.
The actual issue comes from the configuration import mechanism which tries to purge and recreate fields if the UUID is different. See https://www.drupal.org/node/1613424 for more details.
Comment #22
macherifTry to checkout what configuration yml files are displayed as will be deleted then edit every one and remove UUID line in the begin of each file. That works for me !
Comment #23
geerlingguy commentedFor my own purposes, I just replaced the UUID in the
uuid:line ofshortcut.set.default.ymlwithnull(so the line readsuuid: null), and then everything worked fine, even withdrush site-install --config-dir=../config/default(I'm using a project built with Acquia's BLT, alongside the Configuration Split module).Comment #24
Sarah10 commented#6 worked for me. Thanks!!
Comment #25
ruloweb commented#23 worked for me, thanks!
Comment #26
geerlingguy commentedComment #27
mpotter commented#23 no longer seems to work for me. Using drush 8.1.11 on latest drupal 8.3.x
Also, the downside of #23 is that even though you might successfully use "drush site-install standard --config-dir=config/sync" to install the site, once the site is up and you do a "drush config-export", it will update the shortcut.set.default config because now it has a non-null uuid in the site. If you commit this and push your config/sync to your repo, then another developer trying to pull this and run config-import will have trouble cause their uuid won't match.
Makes me wonder if the uuid stuff is causing more harm than good at this point.
Comment #29
mikeoharaYeah, this is a pretty frustrating problem. I've decided to roll my own install profile to ship with our internal starter kit projects that does not include the shortcut module since we invariably never use it in projects.
Comment #30
nerdsteinThis continues to be problematic for me on multiple sites. Is there any momentum toward at least defining a solution?
This pretty much blocks a "standard" site config from being re-installed (critical for building a site locally or working across a team).
Comment #31
jibranThis can actually be a duplicate of #2922417: Profile provided configuration entities can have unmeetable dependencies.
Comment #32
nerdsteinFirst, let me state my opinion that I think the default shortcuts should probably be outside of config altogether. This issue may be just an incremental fix to support previous installs that have already made use of shortcuts being in config. Maybe a separate issue can be created to remove offender(s) from core on new installs (it may exist, even). But, such discretional flexibility in Drupal's framework means this scenario will keep coming up because the Drupal framework does not prohibit items like shortcut.default from being in config (and there could be many other cases outside of the Shortcut example).
UUIDs should be able to be exported into a configuration target from an existing install and subsequently installed in a new site from a defined config directory.
The issue seems to suggest that a completely fresh "standard" install is created first, followed up by a subsequent config import of the defined directory is broken. This approach will fail repeatedly, due to this mismatch of UUIDs after the initial install re-creates configuration with it's own unique UUIDs in conflict to those stored in the existing config directory.
I see two possible problems here: 1. install, 2. after install. Install itself seems to be the primary blocker, as an initial install would at least respect the set of UUIDs imported initially (and, optionally, through the "--config-dir" directive as part of the site install command). After install would only break if, later, the UUIDs become mismatched (which I would hope would only be a result of a manual config change representing a discouraged practice in general).
Should this issue be morphed into fixing an initial site install to respect existing UUIDs? I think thats reasonable.
Comment #33
jibranSo this is related to #2914213: Don't create content in install hooks if module is installed during config import instead.
Comment #34
nerdstein@jibran, as I understand the problem, this is not a duplicate of #2922417.
I think it is closer to #2914213 but it's hard to tell if they are solving the same problems or just related ones. I think they may be different. Both seem to refer to the issue of UUIDs and "content", e.g. the "shortcut.default" config. If content is installed after a site install using a new hook, does this actually solve the issue of the collision? I would suggest it would create the exact same error with the UUIDs colliding since the existing config will collide with the loading of content regardless of when it happens.
The more relevant issue seems to be that a site install seems to load the requested install profile configuration even if a configuration directory is supplied. Some solutions I see are:
1. turning off the UUID collision validation upon site install.
2. exploring conditional logic that checks if a "config-dir" is passed during site install, it overrides what is provided by the install profile (this makes the install profile selection basically invalid, to be honest).
3. core ships with a "load from configuration" profile that operates just like config_installer does. I sense that option 3 is the cleanest but this should be explored much further. I'm unclear on how "config-dir" would maintain support with profiles other than config_installer.
One related issue is around the "config_installer" based approach. By default, core seems to define the initial installed profile in settings.php. This breaks subsequent site installs with config_installer, because it throws an error for differing install profiles due to this hardcoded setting. My sense is that the installation profile config should not be written to settings.php by default (I am unclear on why this is desirable when it seems to be defined in the system settings config).
Comment #35
br0kenValid for 8.5.x but
drush ev '\Drupal::entityManager()->getStorage("shortcut_set")->load("default")->delete();';helps.Comment #36
karimbou commentedWe got the same issue when exporting using drush config export and import, between developers or environments, any idea how to fix this because a part from running drush ev, or editing the yaml to change the uuid to null. And we might forget or someone might waste time finding how to do this.
Comment #38
balsamaI think the only way to reproduce this issue is to use the --config-dir option with Drush 8 and the Standard profile. Now that Drush 9 is out (which doesn't allow you to use the --config-dir option with Standard) I don't think it can be reproduced.
You can use the config_installer profile to basically achieve the same thing as using --config-dir, and it works around problems like these automatically.
@nerdstein re the problem with config_installer changing the install profile - the best way around this I've found is to remove the install_profile key from settings.php entirely and then revoke write access. Drupal > 8.2.x doesn't need that value in settings and won't complain if it doesn't have write access.
Comment #39
berdirI think this is basically by-design, caused by the fact that installing creates new UUID's. It might fail on shortcut having entities but that's a detail, the real issue is that such an import would delete and re-create every single config entity in the system.
If you want to do installs and then share the config, use something like config_installer. Maybe core in the future will change the installer to instead always install based on default config, which then might have uuid's by default, so that the default config is the same on all sites. But that might also have weird side effects.
Comment #40
berdirIn other words, duplicate of #2788777: Allow a site-specific profile to be installed from existing config, you're trying to solve the wrong problem IMHO.
Comment #41
crash_springfield commented@balsama I'm still getting this error with Drush 9 while using the config_installer profile
Comment #43
geerlingguy commentedUgh, just spent another hour working around this by forking standard into a new install profile on the fly.
Comment #45
auxiliaryjoel commentedI'm having this issue. Error when trying to import config via:
drush cim
or
drush cim -y
or
drush cim sync
is always:
Is it safe for me to delete this content from my local build or will that stop something working on my local(staging dev) build?
Assuming that it's safe to delete on localhost,
does that mean I would:
1. Delete the content that the Error suggests
2. re-Export from local: drush cex sync
3. update (commit / push it to my github repo)
4. re-pull to my cpanel
5. in SSH to Cpanel via CLI: drush cim sync
?
Is that the process to fix this error, or am I misunderstanding anything?
Comment #46
Marko B commentedFor me this is more issue about process, so I spent most of the time in drupal 7 exporting/importing DBs for content and config mainly (yeah, using features and db updates for everything on big sites is just too painful). So when D8 came I finally though ok I can have a site locally without exporting/importing DB, so I would naturally install some profile so I can have drupal site and then I would try to import config, of course this doesn't work and we have this other solutions for it, but I would bet many people will expect this to work like I described above. So even if this is by design I think it is not a good design, it is again usual "break your teeth on drupal way" design and think we should have on second step of installation, where you choose a profile, info about "if you want to install drupal site with existing config do/read this".
Comment #47
PhilippVerpoortI'm also stuck with this, and find it rather inconvenient. Any thoughts/progress?
Comment #49
roya-rateshtari commentedI'm on D8.8.2 and still the same issue. I find the configuration management more pain ... everytime you need logging and deleting the default shorcuts and then importing the configs!
I wonder when they will fix this painful issue? Any updates!
Comment #50
loopy1492 commentedI think it isn't being fixed because some folks see it as an error on the part of those of us who aren't elite developers. I guess we're "doing it wrong". Well, if a large number of users seem to have a problem working with something, perhaps the "recommended process" is so badly designed that it desperately needs to be changed.
Comment #51
loopy1492 commentedHere's part of the big problem. We can't install from configuration because of this issue:
https://www.drupal.org/project/drupal/issues/2982052
Meaning that we can't disable the shortcut module in core.extension.yml because the blt-installed empty site has default shortcuts in it. If we could install from configuration instead of importing configuration post-install, this wouldn't really be an issue.
Comment #52
loopy1492 commentedComment #53
loopy1492 commentedWe've tried blacklisting the file in config split and using config ignore. Neither of these things work with BLT setup.
https://docs.acquia.com/blt/developer/config-split/
Comment #55
pameeela commentedUpdated title and issue summary for more clarity around this issue, which still occurs. Leaving as major but I am not sure since there are workarounds? You already have to update the system.site UUID so this is just one other manual change.
Comment #56
shaktikI'm gettting this issue. Error when trying to import config via:
drush cim
or
drush cim -y
or
drush cim sync
also not able to import by Ui.
Comment #57
ressaI just ran into this again, importing an existing site. I first have to set the UUID, delete the default shortcut, and then I can import the configuration:
Comment #58
mikemadison commentedFWIW, and I'm not sure why, this IS an issue in drupal/core's standard but NOT an issue in Acquia Lightning. So there's something that Lightning did to resolve (or work around) this issue that could potentially be ported over here.
Comment #59
berdirI'm 99% sure it's not about what Lightning did but what it _doesn't_ do. Creating default shortcuts. This happens when you have content for the bundles being re-created. shortcuts, nodes, terms, ...
As said several times before, this is just not how it is meant to work. What you're doing is basically re-installing the site, as you remove and re-create every config entity in the system, including fields. If you want that, install from config from the beginning, which is now natively supported with some limitations: https://www.drupal.org/node/2897299. Use that instead of installing and then re-doing everything.
Comment #60
pameeela commented@Berdir I agree, do you think this is works as designed?
No point in keeping open a major bug if the consensus is that it’s not a bug.
Comment #61
jonathanshawPeople hit this a fair bit, so maybe "Supprt request" captures the purpose of the issue now.
Comment #62
pameeela commentedFair enough, in that case it shouldn't be major.
Comment #63
loopy1492 commentedI just hope that moving the goal posts doesn't reduce the urgency required to remediate this. Users are being told to use pipelines and blt to build sites. As it stands, this really doesn't work unless you go a-hunting in issue queues.
Comment #65
joachim commentedI think a lot of this problem could be fixed with #3159848: [Policy] Merge the minimal and standard install profiles into a starting point recipe.
Install from config is great, but it doesn't work if your config was installed from the standard profile, and that's what most people use.
We need an install profile that's a good base to start building from, but doesn't create superfluous stuff that prevents a config import.
Comment #67
glynster commentedFYI for people using Drupal 9
Replace:
$ drush ev '\Drupal::entityManager()->getStorage("shortcut_set")->load("default")->delete();'with:
$ drush ev '\Drupal::EntityTypeManager()->getStorage("shortcut_set")->load("default")->delete();'Comment #68
bhanu951 commentedFor who have Drush 9+ installed.
can solve the issue.
Comment #70
tonytheferg commented+1
drush entity:delete shortcut_setresulted in a WSOD null error on toolbar menu.Error: Call to a member function toUrl() on null in shortcut_toolbar() (line 343 of /var/www/html/web/core/modules/shortcut/shortcut.module)Seemed to be fine after importing the new config.
Comment #71
berdir> Error: Call to a member function toUrl() on null in shortcut_toolbar() (line 343 of /var/www/html/web/core/modules/shortcut/shortcut.module)
Because you deleted shortcut set, you want to delete shortcut.
Comment #72
tonytheferg commentedMakes sense
Comment #74
emb03 commentedIs there a workaround for this? Having same issue.
Comment #75
pameeela commented@emb03, there are two workarounds documented in the issue summary
Comment #78
mbnsorg commentedThis is an older thread, but just noting we ran into the same issues described here.
On D10 (v10.1.6), we attempted exporting/importing very basic site configuration from one dev site to another, but the workarounds described did not work. Notably, once shortcut_set (or shortcut per #71) is deleted, that causes failures in drupal core/shortcut where a "shortcut_set" object is expected to be not-null in a variety of places.
We abandoned the config export/import and used a db dump instead, which was fine for our short term need, but we were surprised that a simple configuration share didn't work.
Comment #79
finaukaufusiI'm also facing this issue in D10.6
I'm working on CI pipeline and I want to import the config to a new Drupal site for testing.
My build always failed in this error.
Comment #80
extexan commentedThis may shed some light on the issue. It seems to me that the full configuration for shortcuts (stored in the database tables) is not being exported to the config yml files.
The 3 attached screenshots show the three tables prefixed with "shortcut" in the site where shortcuts are working.
And here are the three config yml files exported from that site, and imported into another site (in which no shortcuts appear).
I just don't see how the data in the tables could come from the limited data in the yml files.
Comment #82
quietone commentedAbout 5 years ago the category was changed to Support request. And the core queue is not the best place for 'support requests'. The 'support request' option is there for filing support issues for contributed modules and themes. There are several support options listed on our Support page, including the Drupal Forums and Drupal Answers. There is also Drupal Slack.
There are also workarounds given in the issue summary.
I am closing this per the guidance in Handle or refer a support request in an issue.